/* GUI CONVERTED from reconv.p (converter v1.76) Tue Oct  2 12:13:48 2001 */
/* reconv.p - REPETITIVE                                                      */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.5.1.4 $                                                       */
/*!
 * Program to capture queue balances of original Repetitive
 * cum orders into a workfile and print a report of queue balances.
 *
 * The workfile is used for input into reconv2.p.
 *
 * The report can be used as a cycle count worksheet for WIP.
 */
/* REVISION: 7.3      LAST MODIFIED: 05/01/95   BY: WUG *G0LV*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 10/05/00   BY: *N08Y* Kaustubh K.        */
/* REVISION: 9.1      LAST MODIFIED: 07/25/00   BY: *N0GD* Ganga Subramanaian */
/* Revision: 1.5.1.3  BY: Hualin Zhong          DATE: 06/13/01 ECO: *N0ZF*    */
/* $Revision: 1.5.1.4 $    BY: Robin McCarthy   DATE: 10/01/01 ECO: *P025*    */

/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/*V8:ConvertMode=Report                                                       */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE reconv_p_1 "Output Queue!Counted Qty"
/* MaxLen: Comment: */

&SCOPED-DEFINE reconv_p_2 "Mile!Stone"
/* MaxLen: Comment: */

&SCOPED-DEFINE reconv_p_3 "Input Queue Qty!To Transfer"
/* MaxLen: Comment: */

&SCOPED-DEFINE reconv_p_4 "Input Queue!Counted Qty"
/* MaxLen: Comment: */

&SCOPED-DEFINE reconv_p_6 "Reject Queue!Counted Qty"
/* MaxLen: Comment: */

&SCOPED-DEFINE reconv_p_7 "Routing Code!BOM Code"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

define variable i as integer.
define variable input-queue-counted-qty  as character
   format "x(12)" no-undo.
define variable output-queue-counted-qty  as character
   format "x(12)" no-undo.
define variable reject-queue-counted-qty  as character
   format "x(12)" no-undo.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 

 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
with frame a side-labels attr-space width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME


setFrameLabels(frame a:handle).

find first qad_wkfl where qad_key1 = "repwipbals" no-lock no-error.

if available qad_wkfl then do:
   /* THIS PROGRAM HAS BEEN RUN BEFORE */
   {pxmsg.i &MSGNUM=3812 &ERRORLEVEL=2}
end.

find mfc_ctrl where mfc_field = "rpc_using_new" no-lock no-error.

if available mfc_ctrl and mfc_logical = true then do:
   {pxmsg.i &MSGNUM=5122 &ERRORLEVEL=3}
   message.
   message.
   undo, leave.
end.

repeat:
   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "printer"
               &printWidth = 132
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   FORM /*GUI*/ 
      skip(1)
   with STREAM-IO /*GUI*/  frame hh page-top width 132.

   view frame hh.

   for each qad_wkfl where qad_key1 = "repwipbals" exclusive-lock:
      delete qad_wkfl.
   end.

   i = 0.

   for each wo_mstr no-lock
   where wo_type = "C"
         and wo_nbr > ""
         and wo_status <> "C",
   each wr_route no-lock
   where wr_lot = wo_lot
   break by wo_site by wo_part by wo_line by wo_routing by wo_bom_code
         by wr_lot by wr_op with frame f_wo width 132:

      setFrameLabels(frame f_wo:handle).

      if not first-of(wr_lot) then do:
         /*NOTE: FIRST OPERATION IS MEANINGLESS TO NEW REPETITIVE*/
         i = i + 1.

         create qad_wkfl.

         assign
            qad_key1 = "repwipbals"
            qad_key2 = string(i,"9999999999")
            qad_charfld[1] = wr_lot
            qad_charfld[2] = string(wr_op)
            qad_decfld[1] = wr_qty_comp
            qad_decfld[2] = wr_qty_move
            qad_decfld[3] = wr_qty_rjct
            qad_decfld[4] = wr_qty_rwrk
            qad_decfld[5] = max(wr_qty_wip,0).

         down 1.

         display
            wo_site
            wo_part
            wo_line
            wo_routing                                column-label {&reconv_p_7}
            wr_op
            wr_milestone                              column-label {&reconv_p_2}

            max(wr_qty_wip,0) @ wr_qty_wip            column-label {&reconv_p_3}

            "(__________)" @ input-queue-counted-qty  column-label {&reconv_p_4}
            "(__________)" @ output-queue-counted-qty column-label {&reconv_p_1}
            "(__________)" @ reject-queue-counted-qty column-label {&reconv_p_6}
         with width 132 STREAM-IO /*GUI*/ .

         down 1.
         display wo_bom_code @ wo_routing WITH STREAM-IO /*GUI*/ .
      end.

      if last-of(wo_site) then page.
   end.

   hide frame hh.

   {mfrtrail.i}
end.
